<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 先引入核心库 -->
    <script src="./js/react.development.js"></script>
    <!-- 再引入拓展库 用于react支持dom操作 -->
    <script src="./js/react-dom.development.js"></script>
    <!-- 引入jsx转js库 -->
    <script src="./js/babel.min.js"></script>
</head>

<body>
    <div id="test"></div>
    <!-- //此处一定要写babel -->
    <script type="text/babel">
        class Mything extends React.Component {
            skip = () =>{
                const {ipt1} = this
                alert(ipt1.value)
            }
            show = ()=>{
                const {ipt2} = this
                alert(ipt2.value)
            }
            render(){
                return (
                    <div>
                        <input  ref={(c) =>{this.ipt1 = c}} type="text" />
                        <button ref="btn1" onClick={this.skip}>点击</button>
                        <input ref={c =>this.ipt2 = c} type="text" onBlur={this.show} placeholder="离开我会弹出值" />
                    </div>     
                )       
                }
        }
        ReactDOM.render(<Mything/>, document.querySelector('#test'))
    </script>
</body>

</html>